<?php
		/*include_once('init.php');*/


		

        

        $id=!empty($_GET['id'])?$_GET['id']:'';

		

		if(!empty($_POST)) {

      /*  print_r($_POST);die;*/
	
		$_POST['power']=implode(',',$_POST['power']);

		
		

	

		$row=edit('role',$_POST,$id);
        if ($row>0) {
        	echo '<script>alert("添加成功");location.href="index.php?c=role&a=news&admin=1";</script>';

        }else{
        	echo '<script>alert("添加失败");history.go(-1);</script>';die;
        }
    }
		


		$arr=getselectByone('role',"`id`='$id'");
        $arr['power']=explode(',', $arr['power']);
        $date=gatselect('power','pid=0');
        $dates=gatselect('power','pid!=0');
   
   include( VIEW_PATH.$admin.'layst.html');



?>
